]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Properly use modifier keys as a Map
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 10 Sep 2026 12:17:18 +0000 (14:17 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 13 Sep 2026 17:39:10 +0000 (19:39 +0200)
Modifier keys was initialized as a JS Map, but then we used it using the
Object API, attaching data to a map rather than using the actual Map
features

Fixes: 2920738d ("keyboard: Add/handle "modifier" action keys")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4396>
(cherry picked from commit d84ea6c3b45adcea8649a67a946292ea857d807a)

js/ui/keyboard.js

index 42fae6a5658686dcc446e5cd8e0d3730dcc9860c..80f54d1a13ae9fb9b6dcd502ea3c151981f24ca1 100644 (file)
@@ -1536,9 +1536,9 @@ export const Keyboard = GObject.registerClass({
             }
 
             if (key.action === 'modifier') {
-                const modifierKeys = this._modifierKeys[key.keyval] || [];
+                const modifierKeys = this._modifierKeys.get(key.keyval) ?? [];
                 modifierKeys.push(button);
-                this._modifierKeys[key.keyval] = modifierKeys;
+                this._modifierKeys.set(key.keyval, modifierKeys);
             }
 
             if (key.action || key.keyval)
@@ -1559,7 +1559,7 @@ export const Keyboard = GObject.registerClass({
         else
             this._modifiers.delete(keyval);
 
-        for (const key of this._modifierKeys[keyval])
+        for (const key of this._modifierKeys.get(keyval))
             key.setLatched(enabled);
     }